home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Select (Limited Edition)
/
Computer Select.iso
/
pcc
/
v04n12
/
dkmaker.bas
< prev
next >
Wrap
BASIC Source File
|
1991-10-02
|
1KB
|
58 lines
' DKMAKER.BAS (c) 1991 DVA, Inc.
' Creates DKMACS batch file of current DOSKEY macros
'
FileRoot$ = "C:\DKMACS"
FileExt$ = ".BAT"
FileNum% = 0
TempInFile$ = "C:\MACROSIN.$$$"
TempOutFile$ = "C:\MACROSOT.$$$"
ON ERROR GOTO FileCheck
MacroFile$ = FileRoot$ + FileExt$
WHILE (1)
OPEN MacroFile$ FOR INPUT AS 1
CLOSE 1
IF FileNum% < 10 THEN
Number$ = "0" + MID$(STR$(FileNum%), 2, 1)
ELSE
Number$ = MID$(STR$(FileNum%), 2, 2)
END IF
MacroFile$ = FileRoot$ + Number$ + FileExt$
FileNum% = FileNum% + 1
WEND
IsNew:
ON ERROR GOTO 0
ShellString$ = "doskey /macros >" + TempInFile$
SHELL (ShellString$)
OPEN TempInFile$ FOR INPUT AS 1
OPEN TempOutFile$ FOR OUTPUT AS 2
MacCount% = 0
DO
INPUT #1, MacroString$
IF MacroString$ <> "" THEN
IF MacCount% = 0 THEN PRINT #2, "@echo off"
PRINT #2, "doskey "; MacroString$
MacCount% = MacCount% + 1
END IF
LOOP WHILE NOT EOF(1)
CLOSE 1
CLOSE 2
KILL TempInFile$
IF MacCount% = 0 THEN
PRINT "No macros defined in DOSKEY. No batch file created."
KILL TempOutFile$
ELSE
NAME TempOutFile$ AS MacroFile$
PRINT MacroFile$; " file of DOSKEY macros created."
END IF
SYSTEM
END
FileCheck:
SELECT CASE ERR
CASE 53
RESUME IsNew
CASE ELSE
PRINT ERR
END
END SELECT